package top.goldenyear.porpoise.framework.web.core.generator.enums;

import static cn.hutool.v7.core.array.ArrayUtil.firstMatch;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 代码生成的场景枚举
 *
 * @author airhead
 */
@AllArgsConstructor
@Getter
public enum ModuleType {
  /** */
  MODULE(1, "module"),
  PLUGIN(2, "plugin");

  /** 场景 */
  private final Integer type;

  /** 场景名 */
  private final String name;

  public static ModuleType valueOf(Integer type) {
    return firstMatch(moduleType -> moduleType.getType().equals(type), values());
  }
}
